/*
 * @Author: xiawei 1243162387@qq.com
 * @Date: 2024-03-29 13:27:15
 * @LastEditors: xiawei 1243162387@qq.com
 * @LastEditTime: 2024-04-16 17:11:28
 */
import { registerMicroApps  } from 'qiankun';
import userStore from './stores/user';
import microAppStore from './stores/microApp';
export const registerApps = () => {
    const user = userStore();
    const microStores = microAppStore();
    microStores.addUserMicroApps();
    const userApps = microStores.userApps.map(app => {
        return {
            ...app,
            // 基座应用通过props下发数据
            props: {
                token: '123',
                // 用户信息
                userInfo: user.userInfo,
                // 基础路由规则
                baseUrl: app.activeRule
            }
        }
    });
    registerMicroApps(userApps, {
        afterMount : () => microStores.changeLoading(false) as any,
        afterUnmount: () => microStores.changeLoading(true) as any,
    })
}